#ifndef __ACCEPTOR_H__
#define __ACCEPTOR_H__

#include "InetAddress.hpp"
#include "Socket.hpp"


namespace cdm{


class Acceptor{

public:
    Acceptor(uint16_t port,const string &ip = "0.0.0.0");
    ~Acceptor(){}
    void ready();
    int accept();
    int fd();
private:
    void bind();
    void listen();
    void setReuseAddr(bool);
    void setReusePort(bool);

private:
    InetAddress _addr;
    Socket      _socket;

};


}//end of namespace

#endif


